enum {
PROP_0,
- PROP_ITEM_TYPE,
PROP_MODEL,
NUM_PROPERTIES
};
{
GObject parent_instance;
- GType item_type;
GtkSelectionModel *model;
GtkBitset *selection;
};
static GType
gtk_selection_filter_model_get_item_type (GListModel *list)
{
- GtkSelectionFilterModel *self = GTK_SELECTION_FILTER_MODEL (list);
-
- return self->item_type;
+ return G_TYPE_OBJECT;
}
static guint
switch (prop_id)
{
- case PROP_ITEM_TYPE:
- self->item_type = g_value_get_gtype (value);
- break;
-
case PROP_MODEL:
gtk_selection_filter_model_set_model (self, g_value_get_object (value));
break;
switch (prop_id)
{
- case PROP_ITEM_TYPE:
- g_value_set_gtype (value, self->item_type);
- break;
-
case PROP_MODEL:
g_value_set_object (value, self->model);
break;
gobject_class->get_property = gtk_selection_filter_model_get_property;
gobject_class->dispose = gtk_selection_filter_model_dispose;
- /**
- * GtkSelectionFilterModel:item-type:
- *
- * The #GType for elements of this object
- */
- properties[PROP_ITEM_TYPE] =
- g_param_spec_gtype ("item-type",
- P_("Item type"),
- P_("The type of elements of this object"),
- G_TYPE_OBJECT,
- GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY);
-
/**
* GtkSelectionFilterModel:model:
*
/**
* gtk_selection_filter_model_new:
- * @model: the selection model to filter
+ * @model: (allow-none) (transfer none): the selection model to filter, or %NULL
*
* Creates a new #GtkSelectionFilterModel that will include the
* selected items from the underlying selection model.
GtkSelectionFilterModel *
gtk_selection_filter_model_new (GtkSelectionModel *model)
{
- GtkSelectionFilterModel *result;
-
- g_return_val_if_fail (GTK_IS_SELECTION_MODEL (model), NULL);
-
- result = g_object_new (GTK_TYPE_SELECTION_FILTER_MODEL,
- "item-type", g_list_model_get_item_type (G_LIST_MODEL (model)),
- "model", model,
- NULL);
-
- return result;
-}
-
-/**
- * gtk_selection_filter_model_new_for_type:
- * @item_type: the type of the items that will be returned
- *
- * Creates a new empty selection filter model set up to return items
- * of type @item_type. It is up to the application to set a proper
- * selection model to ensure the item type is matched.
- *
- * Returns: a new #GtkSelectionFilterModel
- **/
-GtkSelectionFilterModel *
-gtk_selection_filter_model_new_for_type (GType item_type)
-{
- g_return_val_if_fail (g_type_is_a (item_type, G_TYPE_OBJECT), NULL);
-
return g_object_new (GTK_TYPE_SELECTION_FILTER_MODEL,
- "item-type", item_type,
+ "model", model,
NULL);
}
g_return_if_fail (GTK_IS_SELECTION_FILTER_MODEL (self));
g_return_if_fail (model == NULL || GTK_IS_SELECTION_MODEL (model));
- g_return_if_fail (model == NULL || g_type_is_a (g_list_model_get_item_type (G_LIST_MODEL (model)),
- self->item_type));
if (self->model == model)
return;